<?php
class SessionHandler {
    private  $_conn = null;
    // open
    public function open() {
		$app = app();
		$this->_conn = DbConfig::getRedises('session',$app->vget('UID',true));
        return true;
    }

    //read
    public function read($id) {
      return $this->_conn->get($id);
    }

    //write
    public function write($id, &$data) {
		return $this->_conn->multi()
			->set($id,$data)
			->expire($id,864000) //十天
			->exec();
    }

    // delete
    public function destroy($id) {
      return (bool) $this->_conn->del($id);
    }

    // these methods are unuseful in this implementation
    public function close() {}
    public function gc($max) {}

}
?>
